package edu.zju.gis.dbfg.tileserver.model;

import geotrellis.raster.render.ColorRamp;
import geotrellis.raster.render.ColorRamps;
import lombok.Getter;

/**
 * @author Hu
 * @date 2019/11/27
 * geotrellis 支持的 color ramp
 **/
@Getter
public enum GeotrellisTileColorRamp {

  BLUE_TO_RANGE(ColorRamps.BlueToOrange(), 1), BLUE_TO_RED(ColorRamps.BlueToRed(), 2);

  public ColorRamp cr;
  public int index;

  GeotrellisTileColorRamp(ColorRamp cr, int index) {
    this.cr = cr;
    this.index = index;
  }

  public static ColorRamp getByIndex(int index) {
    for (GeotrellisTileColorRamp ramp: GeotrellisTileColorRamp.values()) {
      if (ramp.getIndex() == index) {
        return ramp.getCr();
      }
    }
    return null;
  }

}
